package com.wms.dataSource;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Component
public class dSource {
	
//	private static final ApplicationContext  ctx = new ClassPathXmlApplicationContext("classpath:ApplicationContext.xml");
	
	@Resource(name="sqlSessionFactory1")
	private SqlSessionFactory ssf1 ;
	
	@Resource(name="sqlSessionFactory2")
	private SqlSessionFactory ssf2 ;

	public void setSsf1(SqlSessionFactory ssf1) {
		this.ssf1 = ssf1;
	}

	public void setSsf2(SqlSessionFactory ssf2) {
		this.ssf2 = ssf2;
	}
	
	
	public SqlSessionFactory initinalDataSource(String className){
		System.out.println("className is \t"+className);
		return ssf2;
	}

	
	
	
//	*******************************************************************************
	public SqlSessionFactory getSsf1() {
		return ssf1;
	}
	
	public SqlSessionFactory getSsf2() {
		return ssf2;
	}
	
}
